
<extend name="Application/Admin/View/layout.html" />
<block name="mid">
     <div id="page-wrapper">
            <div id="page-inner">
                <div class="row">
                    <div class="col-md-12">
                        <h1 class="page-head-line">会员添加</h1>
                        <h1 class="page-subhead-line">This is dummy text , you can replace it with your original text. </h1>

                    </div>
                </div>
                <!-- /. ROW  -->
                <div class="row">

<div class="col-md-6 col-sm-6 col-xs-12">
               <div class="panel panel-danger">
                        <div class="panel-heading">
                           SINGUP FORM
                        </div>
                        <div class="panel-body">
                            <form role="form" id="signupForm" action="" method="post"  enctype="multipart/form-data" >


                                 <div class="form-group">
                                            <label>用户名</label>
                                            <input type="text" class="form-control" name="username">

                                     <p class="help-block ">Help text here.</p>
                                        </div>
                                         <div class="form-group">
                                            <label>角色</label>
                                            <select class="form-control" name="pid">
                                                <option value="0">顶级层</option>
                                               <foreach name="group" item="v">

                                                <option value="{$v.id}">{$v.title}</option>
                                                </foreach>
                                            </select>
                                        </div>
                                            <div class="form-group">
                                            <label>密码</label>
                                            <input type="text" class="form-control" id="password"  name="password">
                                     <p class="help-block ">Help text here.</p>
                                        </div>
                                              <div class="form-group">
                                            <label>确认密码</label>
                                            <input type="text" class="form-control" name="password_again"  >
                                     <p class="help-block ">Help text here.</p>
                                        </div>
                                           <div class="form-group">
                                            <label>头像上传</label>
                                           <input type="file" multiple="" class="form-control" id="error" name="avathor" />
                                     <p class="help-block ">Help text here.</p>
                                        </div>


                                         <div class="form-group">
                                            <label>性别</label>
                                            <div class="radio">
                                                <label>
                                                    <input type="radio" name="sex" id="optionsRadios1" value="option1" checked="" required>男
                                                </label>
                                            </div>
                                            <div class="radio">
                                                <label>
                                                    <input type="radio" name="sex" id="optionsRadios2" value="option2">女
                                                </label>
                                            </div>

                                        </div>
                                        <div class="form-group">
                                            <label>手机号</label>
                                            <input type="text" class="form-control" name="tell" id="tell">
                                          <input type="button" id="code" value="点击发送"></input>

                                     <p class="help-block ">Help text here.</p>
                                        </div>
                                    <p class="help-block">Help text here.</p>
                                         <input class="btn btn-danger" type="submit" value="提交 Now"  >
                                    </form>
                            </div>
                        </div>
                            </div>
        </div>
             <!--/.ROW-->

            </div>
            <!-- /. PAGE INNER  -->
        </div>
<style>
.error{
  color:red;
}
</style>
        </block>
         <block name="js">
<script  type="text/javascript" src="__ROOT____Admin__assets/js/jquery-1.10.2.js"></script>
 <script type="text/javascript" src="__ROOT____Admin__assets/js/jquery.validate.min.js"/></script>

  <script type="text/javascript">
$(document).ready(function() {

// 在键盘按下并释放及提交后验证提交表单
  $("#signupForm").validate({
    // debug:true,
  //  errorElement: "span",
    rules: {
      username: {
        required: true,
        minlength: 2
      },
       password: {
        required: true,
        minlength: 5,

    },
    password_again:{
       equalTo:"#password"
      },
    },

    messages: {
        username: {  //错误提示信息
        required: " (必需字段)",
        minlength: " (不能少于 3 个字母)"
        },

        password: {
        required: "请输入密码",
        minlength: "密码长度不能小于 5 个字母"
        },
        password_again:{
       equalTo:"请输入与密码一样的值"
      },

  },
  errorElement:'p',
  errorClass:'error',
  })


  // 短信验证

$('#code').click(function(event) {

  var s=10;
  var time=0;
  var code=$(this);
  var tell=$('#tell').val();
 // alert(tell);
  $.ajax({
    url:"{:U('admin/ajax/send_sms')}",
    data:{
      'tell':tell,
    },
    type:'post',
    success:function(yan){

   //alert(yan)
      if(yan>0){
        alert("发送成功");
      }else{
        alert("发送失败");
      }
    }

  })
time=setInterval(function(){
    if (s>0) {
      var t=s+'秒后可重新发送';
      code.val(t);
      code.attr('disabled','disabled');
      s--;
    }else{
      s=10;
       var t='点击即可发送验证码';
      code.val(t);
      code.attr('disabled',false);
      clearInterval(time);

    }



},1000)

})
})

        </script>

        </block>